package com.atwbj.langchain4jbeta3learndemo.controller;


import com.atwbj.langchain4jbeta3learndemo.service.FunctionAssistant;
import dev.langchain4j.model.embedding.EmbeddingModel;
import dev.langchain4j.store.embedding.EmbeddingStore;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * @auther zzyybs@126.com
 * @Date 2025-06-02 17:01
 * @Description: TODO
 */
@RestController
@Slf4j
public class ChatFunctionCallingController {
    @Resource
    private FunctionAssistant functionAssistant;

    //  http://localhost:9011/chatfunction/test1
    @GetMapping(value = "/chatfunction/test1")
    public String test1() {
    // FunctionAssistant里面调用了大模型，大模型还可以使用我们给它配置的 开发票工具、远程调用天气API。让大模型的功能跟更强大。
        String chat = functionAssistant.chat("开张发票,公司：尚硅谷教育科技有限公司 税号：atguigu533 金额：668.12");

        System.out.println(chat);
        return "success : " + LocalDateTime.now() + "\t" + chat;
    }
}
